package sunstar.com.xq.activity

import android.os.Bundle
import android.support.v7.widget.LinearLayoutManager
import com.google.gson.Gson
import kotlinx.android.synthetic.main.activity_time_line.*
import sunstar.com.xq.R
import sunstar.com.xq.adapter.TimeLineAdapter
import sunstar.com.xq.databean.CardData
import sunstar.com.xq.databean.PublicStaticBean
import sunstar.com.xq.databean.UserData
import sunstar.com.xq.presenter.TimeLinePresent
import sunstar.com.xq.view.RecycleAdapterView

class TimeLineActivity : BaseActivity(),RecycleAdapterView {
    override fun refreshData() {
        dialoUtil!!.dismiss()
        adapter!!.notifyDataSetChanged()
    }
    var dataList = mutableListOf<CardData>()
    var presenter : TimeLinePresent? = null
    var adapter:TimeLineAdapter?=null
    override fun setBaseView(): Int = R.layout.activity_time_line

    override fun setTitleText(): String ="帖子列表"

    override fun showTitle(): Boolean = true

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        presenter = TimeLinePresent(this,dataList)
        adapter = TimeLineAdapter(this,dataList)
        time_line_view.adapter = adapter
        time_line_view.layoutManager = LinearLayoutManager(this)
        time_line_view.isNestedScrollingEnabled = false
        dialoUtil!!.show()
        presenter!!.getData(PublicStaticBean.getUser(this).objectId)
    }
}
